package com.econ.powercloud.ems.common.enums;

/**
 * @author zjr
 * @create 2021/7/23 下午3:55
 * @description 充放电状态
 */
public enum ChargeDischargeType implements EnumMethod {
    CHARGE(0, "充电"),
    DISCHARGE(1, "放电"),
    STANBY(2,"待机");

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    ChargeDischargeType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ChargeDischargeType fromCode(Integer code) {
        for (ChargeDischargeType type : ChargeDischargeType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
